.health-report-container {
  background-color: #f5f7f9;
  padding: 15px;
  height: calc(100vh - 84px);
  overflow: hidden;

  .app-container {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 12px 0 rgba(0, 0, 0, .1);
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 15px;
  }

  /* 头部区域 */

  .report-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
    position: relative; /* 添加相对定位，为下拉面板提供定位上下文 */
    z-index: 1; /* 确保头部在其他元素之上 */

    .report-title {
      font-size: 24px;
      font-weight: bold;
      color: #303133;
      margin: 0 0 6px 0;
    }

    .report-subtitle {
      font-size: 12px;
      color: #909399;
      margin: 0;
    }

    .header-controls {
      display: flex !important;
      align-items: center;
      gap: 20px;
      height: 52px; /* 恢复固定高度 */
      position: relative; /* 为下拉面板定位提供参考 */
    }

    /* 时间选择器 */

    .time-selector {
      display: flex !important;
      gap: 12px;
      padding: 8px;
      background: #fff;
      border-radius: 8px;
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
      height: 52px; /* 固定高度 */
      box-sizing: border-box; /* 确保padding包含在高度内 */
      position: relative; /* 为下拉面板定位提供参考 */

      ::v-deep .el-button {
        flex: 1;
        height: 36px;
        border-radius: 6px;
        font-weight: 500;
        font-size: 13px;

        &.el-button--primary {
          background-color: #409eff;
          border-color: #409eff;
        }
      }
    }

    /* 历史报告选择区域 */

    .history-selector {
      display: flex !important;
      align-items: center;
      gap: 10px;
      height: 52px; /* 固定高度 */
      position: relative; /* 为下拉面板定位提供参考 */
    }

    .history-selector ::v-deep .el-date-editor {
      width: 160px;
      align-self: center; /* 确保在容器中垂直居中 */
    }

    .history-selector ::v-deep .el-date-editor .el-input__inner {
      border-radius: 6px;
      padding: 8px 12px;
      height: 36px;
    }
    .history-selector ::v-deep .el-date-editor .el-picker-panel {
      position: absolute !important;
      top: 100% !important;
      left: 0 !important;
      z-index: 2000 !important;
    }
    .clear-selection-btn {
      color: #606266;
      font-size: 13px;
      padding: 8px;
    }

    .clear-selection-btn:hover {
      color: #409eff;
    }

    .current-report-info {
      display: flex;
      align-items: center;
      gap: 4px;
      font-size: 12px;
      color: #409eff;
      background-color: #ecf5ff;
      padding: 6px 10px;
      border-radius: 12px;
      border: 1px solid #b3d8ff;
    }

    .current-report-info i {
      font-size: 12px;
    }

    .header-info {
      display: flex;
      align-items: center;
      gap: 15px;

      .date-info {
        font-size: 12px;
        color: #909399;

        .date-value {
          margin-left: 6px;
          font-weight: 500;
          color: #606266;
        }
      }

      .avatar-container {
        .user-avatar {
          width: 36px;
          height: 36px;
          border-radius: 50%;
          border: 2px solid #409eff;
          object-fit: cover;
        }
      }
    }
  }

  /* 主要内容区域 */

  .main-content {
    display: flex;
    gap: 15px;
    flex: 1;
    overflow: hidden;

    /* 健康指标 */

    .health-indicators {
      flex: 2;
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
      gap: 15px;
      overflow-y: auto;
      padding-right: 8px;

      /* 滚动条样式 */

      &::-webkit-scrollbar {
        width: 6px;
      }

      &::-webkit-scrollbar-thumb {
        background-color: #dcdfe6;
        border-radius: 3px;
      }

      .health-card {
        background: #fff;
        border-radius: 10px;
        box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
        padding: 20px;
        cursor: pointer;
        transition: all 0.3s ease;
        border: 1px solid #ebeef5;

        &:hover {
          transform: translateY(-3px);
          box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1);
        }

        .card-header {
          display: flex;
          justify-content: space-between;
          align-items: flex-start;
          margin-bottom: 18px;

          .card-title {
            h3 {
              font-size: 18px;
              font-weight: 600;
              color: #303133;
              margin: 0 0 6px 0;
            }

            p {
              font-size: 13px;
              color: #909399;
              margin: 0;
            }
          }

          .card-icon {
            width: 48px;
            height: 48px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 22px;

            &.heart-rate {
              background-color: rgba(22, 93, 255, 0.1);
              color: #165dff;
            }

            &.ecg {
              background-color: rgba(255, 107, 107, 0.1);
              color: #FF6B6B;
            }

            &.blood-pressure {
              background-color: rgba(248, 114, 114, 0.1);
              color: #f87272;
            }

            &.blood-sugar {
              background-color: rgba(54, 211, 153, 0.1);
              color: #36d399;
            }

            &.oxygen-level {
              background-color: rgba(54, 211, 153, 0.1);
              color: #36d399;
            }

            &.sleep {
              background-color: rgba(251, 146, 60, 0.1);
              color: #fb923c;
            }

            &.steps {
              background-color: rgba(22, 93, 255, 0.1);
              color: #165dff;
            }
          }
        }

        .card-body {
          display: flex;
          justify-content: space-between;
          align-items: flex-end;
          margin-bottom: 18px;

          .metric-value {
            .value {
              font-size: 32px;
              font-weight: 700;
              color: #303133;
            }

            .unit {
              font-size: 14px;
              color: #909399;
              margin-left: 5px;
            }
          }

          .metric-status {
            font-size: 13px;
            display: flex;
            align-items: center;

            &.status-success {
              color: #67c23a;
            }

            &.status-warning {
              color: #e6a23c;
            }

            i {
              margin-right: 5px;
            }
          }
        }

        .chart-container {
          height: 120px;
          margin-bottom: 18px;
          position: relative;
          background-color: #fafafa;
          border-radius: 6px;

          .mini-chart {
            width: 100%;
            height: 100%;
            min-height: 120px;
          }
        }

        .health-advice {
          background-color: rgba(22, 93, 255, 0.05);
          border-radius: 8px;
          padding: 12px;
          transition: all 0.3s ease;

          &.health-advice-warning {
            background-color: rgba(230, 162, 60, 0.15);
            border-left: 4px solid #e6a23c;
          }

          .advice-header {
            display: flex;
            align-items: center;
            gap: 8px;
            margin-bottom: 8px;

            .advice-icon {
              color: #409eff;
              font-size: 14px;

              .health-advice-warning & {
                color: #e6a23c;
              }
            }

            .advice-title {
              font-size: 12px;
              font-weight: 500;
              color: #303133;
              margin: 0;
            }
          }

          .advice-content {
            font-size: 12px;
            color: #909399;
            margin: 0;
            line-height: 1.5;

            .health-advice-warning & {
              color: #e6a23c;
              font-weight: 500;
            }
          }
        }
      }
    }

    /* 健康分析 */

    .health-analysis {
      flex: 1;
      display: flex;
      flex-direction: column;
      gap: 15px;
      overflow-y: auto;
      padding-right: 8px;

      /* 滚动条样式 */

      &::-webkit-scrollbar {
        width: 6px;
      }

      &::-webkit-scrollbar-thumb {
        background-color: #dcdfe6;
        border-radius: 3px;
      }

      .analysis-card {
        background: #fff;
        border-radius: 10px;
        box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
        padding: 20px;
        border: 1px solid #ebeef5;

        .analysis-title {
          font-size: 18px;
          font-weight: 600;
          color: #303133;
          margin: 0 0 20px 0;

          &.with-icon {
            display: flex;
            align-items: center;
            gap: 8px;
          }

          .risk-icon {
            color: #e6a23c;
            font-size: 16px;
          }

          .suggestion-icon {
            color: #409eff;
            font-size: 16px;
          }
        }

        /* 健康评分 */

        .score-container {
          display: flex;
          justify-content: center;
          margin-bottom: 20px;

          .chart-wrapper {
            position: relative;
            width: 120px;
            height: 120px;

            .score-chart {
              width: 100%;
              height: 100%;
              min-height: 120px;
            }

            .score-info {
              position: absolute;
              top: 50%;
              left: 50%;
              transform: translate(-50%, -50%);
              display: flex;
              flex-direction: column;
              align-items: center;

              .score-value {
                font-size: 28px;
                font-weight: 700;
                color: #303133;
              }

              .score-text {
                font-size: 14px;
                color: #909399;
              }
            }
          }
        }

        .score-description {
          font-size: 14px;
          color: #909399;
          line-height: 1.5;
          text-align: center;
        }

        /* 健康隐患 */

        .risks-container {
          .risk-item {
            display: flex;
            gap: 12px;
            padding: 15px;
            border-radius: 8px;
            margin-bottom: 15px;

            &:last-child {
              margin-bottom: 0;
            }

            &.risk-bg-warning {
              background-color: rgba(230, 162, 60, 0.1);
            }

            &.risk-bg-success {
              background-color: rgba(103, 194, 58, 0.1);
            }

            .risk-icon-container {
              font-size: 18px;
              margin-top: 2px;

              &.risk-icon-warning {
                color: #e6a23c;
              }

              &.risk-icon-success {
                color: #67c23a;
              }
            }

            .risk-content {
              flex: 1;

              .risk-title {
                font-size: 15px;
                font-weight: 500;
                color: #303133;
                margin: 0 0 5px 0;
              }

              .risk-description {
                font-size: 13px;
                color: #909399;
                margin: 0;
                line-height: 1.5;
              }
            }
          }
        }

        /* 健康建议 */

        .suggestions-container {
          .suggestion-item {
            display: flex;
            gap: 12px;
            margin-bottom: 20px;

            &:last-child {
              margin-bottom: 0;
            }

            .suggestion-icon-container {
              font-size: 18px;
              margin-top: 2px;
              color: #409eff;
            }

            .suggestion-content {
              flex: 1;

              .suggestion-title {
                font-size: 15px;
                font-weight: 500;
                color: #303133;
                margin: 0 0 5px 0;
              }

              .suggestion-description {
                font-size: 13px;
                color: #909399;
                margin: 0;
                line-height: 1.5;
              }
            }
          }
        }
      }
    }
  }

  /* 图表模态框 */

  ::v-deep .chart-dialog {
    .el-dialog {
      border-radius: 10px;
      max-height: 80vh;
      display: flex;
      flex-direction: column;

      .el-dialog__header {
        padding: 15px 15px 8px;
        border-bottom: 1px solid #eee;

        .el-dialog__title {
          font-size: 18px;
          font-weight: 600;
        }
      }

      .el-dialog__body {
        flex: 1;
        overflow-y: auto;
        padding: 15px;
      }

      .el-dialog__footer {
        padding: 8px 15px 15px;
        border-top: 1px solid #eee;
      }
    }
  }

  /* 响应式设计 */
  @media (max-width: 1200px) {
    .main-content {
      flex-direction: column;

      .health-indicators {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
      }

      .health-analysis {
        flex-direction: row;
        flex-wrap: wrap;

        .analysis-card {
          flex: 1;
          min-width: 300px;
        }
      }
    }
  }

  @media (max-width: 768px) {
    padding: 10px;

    .app-container {
      padding: 12px;
    }

    .report-header {
      flex-direction: column;
      align-items: flex-start;
      gap: 12px;

      .header-info {
        width: 100%;
        justify-content: space-between;
      }
    }

    .time-selector {
      flex-wrap: wrap;

      ::v-deep .el-button {
        flex: none;
        min-width: 70px;
        height: 32px;
        font-size: 12px;
      }
    }

    .main-content {
      .health-indicators {
        grid-template-columns: 1fr;
      }

      .health-analysis {
        flex-direction: column;

        .analysis-card {
          min-width: 100%;
        }
      }
    }
  }
}

@keyframes pulse {
  0% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.1);
    opacity: 0.8;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

@-webkit-keyframes pulse {
  0% {
    -webkit-transform: scale(1);
    opacity: 1;
  }
  50% {
    -webkit-transform: scale(1.1);
    opacity: 0.8;
  }
  100% {
    -webkit-transform: scale(1);
    opacity: 1;
  }
}

/* 由于模态框使用 append-to-body，需要将这部分样式作为全局样式 */
.chart-dialog .dialog-content .metric-info {
  font-size: 14px;
  color: #606266;
  margin-bottom: 15px;
  line-height: 1.6;
  padding: 15px;
  background: linear-gradient(135deg, rgba(64, 158, 255, 0.08) 0%, rgba(64, 158, 255, 0.03) 100%);
  border-radius: 8px;
  border-left: 4px solid #409eff;
  box-shadow: 0 2px 6px rgba(64, 158, 255, 0.1);
}

.chart-dialog .dialog-content .metric-info .metric-description {
  margin-bottom: 10px;
}

.chart-dialog .dialog-content .metric-info .normal-range {
  display: flex;
  align-items: center;
  gap: 8px;
}

.chart-dialog .dialog-content .metric-info .normal-range .label {
  font-weight: 600;
  color: #409eff;
}

.chart-dialog .dialog-content .metric-info .normal-range .value {
  font-weight: 500;
  color: #303133;
  background-color: rgba(64, 158, 255, 0.1);
  padding: 3px 8px;
  border-radius: 4px;
}

.chart-dialog .dialog-content .chart-container-large {
  height: 300px;
  margin-bottom: 15px;
  position: relative;
  background-color: #fafafa;
  border-radius: 6px;
  display: block;
}

.chart-dialog .dialog-content .chart-container-large .large-chart {
  width: 100%;
  height: 100%;
  min-height: 300px;
  display: block;
  position: relative;
  z-index: 1;
}

.chart-dialog .health-advice-modal {
  background: linear-gradient(135deg, rgba(64, 158, 255, 0.1) 0%, rgba(64, 158, 255, 0.05) 100%);
  border-radius: 12px;
  padding: 20px;
  margin-top: 15px;
  border: 1px solid rgba(64, 158, 255, 0.2);
  box-shadow: 0 4px 12px rgba(64, 158, 255, 0.1);
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
}

.chart-dialog .health-advice-modal::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: linear-gradient(to bottom, #409eff, #8cc5ff);
}

.chart-dialog .health-advice-modal.health-advice-warning {
  background: linear-gradient(135deg, rgba(230, 162, 60, 0.15) 0%, rgba(230, 162, 60, 0.08) 100%);
  border: 1px solid rgba(230, 162, 60, 0.3);
  box-shadow: 0 4px 12px rgba(230, 162, 60, 0.15);
}

.chart-dialog .health-advice-modal.health-advice-warning::before {
  background: linear-gradient(to bottom, #e6a23c, #f3d19e);
}

.chart-dialog .health-advice-modal .advice-header-modal {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 15px;
}

.chart-dialog .health-advice-modal .advice-header-modal .advice-icon-modal {
  color: #409eff;
  font-size: 20px;
  -webkit-animation: pulse 2s infinite;
  animation: pulse 2s infinite;
}

.chart-dialog .health-advice-modal.health-advice-warning .advice-header-modal .advice-icon-modal {
  color: #e6a23c;
}

.chart-dialog .health-advice-modal .advice-header-modal .advice-title-modal {
  font-size: 18px;
  font-weight: 600;
  color: #303133;
  margin: 0;
}

.chart-dialog .health-advice-modal .advice-content-wrapper .advice-content-modal {
  font-size: 14px;
  color: #606266;
  margin: 0 0 15px 0;
  line-height: 1.7;
  padding-left: 30px;
  position: relative;
}

.chart-dialog .health-advice-modal .advice-content-wrapper .advice-content-modal::before {
  content: "❝";
  position: absolute;
  left: 0;
  top: -5px;
  font-size: 24px;
  color: #409eff;
  opacity: 0.5;
}

.chart-dialog .health-advice-modal.health-advice-warning .advice-content-wrapper .advice-content-modal {
  color: #c38f33;
  font-weight: 500;
}

.chart-dialog .health-advice-modal .advice-content-wrapper .advice-highlight {
  background-color: rgba(230, 162, 60, 0.2);
  border-radius: 8px;
  padding: 12px 15px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-left: 4px solid #e6a23c;
}

.chart-dialog .health-advice-modal .advice-content-wrapper .advice-highlight i {
  color: #e6a23c;
  font-size: 18px;
}

.chart-dialog .health-advice-modal .advice-content-wrapper .advice-highlight span {
  font-weight: 600;
  color: #c38f33;
  font-size: 14px;
}
